import request from '@/utils/request'

export function save(form) {
  return request({
    url: '/api/sys/menu/save',
    method: 'post',
    data: {
      menu_name: form.menu_name,
      menu_url: form.menu_url,
      menu_desc: form.menu_desc,
      menu_target: form.menu_target,
      menu_css: form.menu_css,
      menu_icon: form.menu_icon,
      menu_order: form.menu_order,
      menu_pid: form.menu_pid
    }
  })
}

export function tree() {
  return request({
    url: '/api/sys/menu/tree',
    method: 'post',
    data: {}
  })
}

export function update(form) {
  return request({
    url: '/api/sys/menu/update',
    method: 'post',
    data: {
      menu_name: form.menu_name,
      menu_url: form.menu_url,
      menu_desc: form.menu_desc,
      menu_target: form.menu_target,
      menu_css: form.menu_css,
      menu_icon: form.menu_icon,
      menu_order: form.menu_order,
      menu_id: form.menu_id
    }
  })
}

export function disable(menu_id) {
  return request({
    url: '/api/sys/menu/disable',
    method: 'post',
    data: {
      menu_id: menu_id
    }
  })
}

export function enable(menu_id) {
  return request({
    url: '/api/sys/menu/enable',
    method: 'post',
    data: {
      menu_id: menu_id
    }
  })
}
